package com.gitee.huxing.course.service;

import com.gitee.huxing.framework.core.ServiceResolver;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @Description:
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.service
 * @ClassName: DemoResolver
 * @Author: huxing
 * @DateTime: 2021-10-03 下午3:46
 */
@SuppressWarnings("all")
public class DemoResolver implements ServiceResolver, ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    @Override
    public <T> T reslove(String serviceClass) {
        return (T)this.applicationContext.getBean(serviceClass);
    }
}
